import request from '@/utils/request';


export async function pageDemand(projectId, params) {
    return request(`/project/${projectId}/demand/page`, {
        params,
    });
}

export async function saveNewDemand(projectId, data) {
    return request(`/project/${projectId}/demand`, {
        method: "POST",
        data: data
    });
}

export async function updateDemand(projectId, demandId, data) {
    return request(`/project/${projectId}/demand/${demandId}`, {
        method: "POST",
        data: data
    });
}

export async function getDetail(projectId, demandId) {
    return request(`/project/${projectId}/demand/${demandId}`);
}

export async function deleteDemand(projectId, demmandId) {
    return request(`/project/${projectId}/demand/${demmandId}`, {
        method: "DELETE",
    });
}

export async function updateIsArchived(projectId, demmandId, isArchived) {
    return request(`/project/${projectId}/demand/${demmandId}/${isArchived}`, {
        method: "POST",
    });
}